<template>
  <div class="goodListShow">
    <div style="height:50px">
      <el-button type="primary" style="float:left;margin-left:30px;" @click="cls">返回上一级</el-button>
    </div>
    <el-table :data="list" style="width: 100%" :border="true" :highlight-current-row="true">
      <el-table-column label="序号" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.data_id }}</span>
        </template>
      </el-table-column>
      <el-table-column label="ID" align="center">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.detail_id }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="商品单价" align="center">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.goods_size }}元</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="商品数量" align="center">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.number_size }}</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="数据日期" align="center">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <span>{{ scope.row.data_day }}</span>
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import request from '@/utils/request'
import { getToken, getAccount } from '@/utils/auth'
export default {
  data() {
    return {
      list: [],
      temp: {},
      id: '',
      data: ''
    }
  },
  mounted() {
    this.id = this.$route.query.id
    this.data = this.$route.query.data
    this.temp = {
      data_day: this.data,
      data_id: this.id,
      page_size: 10,
      current_page: 1
    }
    this.getList()
  },
  methods: {
    // 返回上一级
    cls() {
      //  this.$router.push({ path: "//order/goodList" });
      this.$router.go(-1) // 刷新页面
    },
    getList() {
      return request({
        url: '/v3/admin/operator/data/detail/list',
        method: 'post',
        headers: {
          account_type: getAccount()
        },
        data: this.temp
      }).then(res => {
        res.list.map((value, index) => {
          value.goods_size = value.goods_size / 100
        })
        this.list = res.list
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.goodListShow {
  margin-top: 60px;
}
</style>
